/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package cassandrawindow;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;

import java.util.Date;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.*;
/**
 *
 * @author MT140QuyenNB
 */

public class TestThreadVCBanerHourCPM implements Runnable{
   
    Thread runner;

    public TestThreadVCBanerHourCPM()
    {
        runner = new Thread(this);
        runner.start();
    }

    public void run()
    {
        HandleDataTableBannerHourV2 hdtb = new HandleDataTableBannerHourV2();
        try {         
                hdtb.handleData();
            
        } catch (Exception ex){
            Debug.println(ex.getMessage());
        }
    }

    public static boolean checkTime(int hour, int minute)
    {
            boolean check = false;

            Date date = new Date();   // given date
            Calendar calendar = GregorianCalendar.getInstance(); // creates a new calendar instance
            calendar.setTime(date);   // assigns calendar to given date
            calendar.get(Calendar.HOUR_OF_DAY); // gets hour in 24h format
            calendar.get(calendar.MINUTE);
            calendar.get(calendar.SECOND);

            if ((calendar.get(Calendar.HOUR_OF_DAY) == hour)&&(calendar.get(calendar.MINUTE) == minute))
            {
                check = true;
            }
            return check;
    }

    public static int getHour()
    {
            Date date = new Date();   // given date
            Calendar calendar = GregorianCalendar.getInstance(); // creates a new calendar instance
            calendar.setTime(date);   // assigns calendar to given date

            return calendar.get(Calendar.HOUR_OF_DAY);
    }

}

